//
//  HelpViewController.m
//  SelfDriving
//
//  Created by apple on 16/1/10.
//  Copyright © 2016年 apple. All rights reserved.
//

#import "HelpViewController.h"

@interface HelpViewController ()

@end

@implementation HelpViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.navigationController.navigationBarHidden = NO;
}

-(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{
    return 2;
}
-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
    if (section == 0) {
        return 1;
    }
    if (section == 1) {
        return 5;
    }
    
    return 0;
}
-(CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section{
    return 1;
}
-(CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section{
    
    
    return 8;
}
-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
    if (indexPath.section == 0 ) {
        return 120;
    }
    if (indexPath.section == 1) {
        return 40;
    }
    return 0;
}

-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"cell"];
    cell = [[UITableViewCell alloc]initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:@"cell"];
    if (indexPath.section == 0) {
        cell.selectionStyle = UITableViewCellSelectionStyleNone;
        if(indexPath.row == 0){
            UIImageView *img = [[UIImageView alloc]initWithFrame:CGRectMake(SCRE_WIDTH/2-48, 10, 96, 96)];
            img.image = [UIImage imageNamed:@"bangzhu"];
            [cell.contentView addSubview:img];
            
        }
        
        
    }
    if (indexPath.section == 1) {
        cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
        if(indexPath.row == 0){
            cell.textLabel.text = @"帮助与反馈";
        }
        if(indexPath.row == 1){
            cell.textLabel.text = @"用户协议";
            
        }
        if(indexPath.row == 2){
            cell.textLabel.text = @"一米平台行为规范";
        }
        if(indexPath.row == 3){
            cell.textLabel.text = @"给一米评分";
        }
        if(indexPath.row == 4){
            cell.textLabel.text = @"当前版本";
            cell.detailTextLabel.text = @"10.0.0";
        }
    }
    return cell;
}
-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
    [tableView deselectRowAtIndexPath:indexPath animated:YES];
    if (indexPath.section == 1) {
        if (indexPath.row == 0) {
            UIStoryboard *customerStoryboard = [UIStoryboard storyboardWithName:@"GR"
                                                                         bundle:[NSBundle mainBundle]];
            UIViewController *searchResultDetailController = [customerStoryboard instantiateViewControllerWithIdentifier:@"FeedbackVC"];
            [self.navigationController pushViewController:searchResultDetailController animated:YES];
        }
        if (indexPath.row == 1) {
            UIStoryboard *customerStoryboard = [UIStoryboard storyboardWithName:@"FJ"
                                                                         bundle:[NSBundle mainBundle]];
            WebViewController *searchResultDetailController = [customerStoryboard instantiateViewControllerWithIdentifier:@"WebVC"];
            searchResultDetailController.titlename = @"用户协议";
            searchResultDetailController.Url = userprotocolurl;
            [self.navigationController pushViewController:searchResultDetailController animated:YES];
        }
        if (indexPath.row == 2) {
            UIStoryboard *customerStoryboard = [UIStoryboard storyboardWithName:@"FJ"
                                                                         bundle:[NSBundle mainBundle]];
            WebViewController *searchResultDetailController = [customerStoryboard instantiateViewControllerWithIdentifier:@"WebVC"];
            searchResultDetailController.titlename = @"一米平台行为规范";
            searchResultDetailController.Url = guihuanurl;
            [self.navigationController pushViewController:searchResultDetailController animated:YES];
        }
    }
}


- (IBAction)backActino:(id)sender {
    [self.navigationController popViewControllerAnimated:YES];
}


- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
 #pragma mark - Navigation
 
 // In a storyboard-based application, you will often want to do a little preparation before navigation
 - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
 // Get the new view controller using [segue destinationViewController].
 // Pass the selected object to the new view controller.
 }
 */

@end
